home *** CD-ROM | disk | FTP | other *** search
/ Merciful 4 / Merciful - Disc 4.iso / software / p / psychotoads.dms / psychotoads.adf / a56 < prev    next >
Text File  |  1989-03-31  |  26KB  |  860 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.                             5: STRING FUNCTIONS                             54
  10.                        -----------------------------
  11.  
  12.  
  13.          =LEFT$= (return the leftmost characters of a string)
  14.  
  15. d$=LEFT$(s$,n)
  16.  
  17. This instruction works like in nearly any Basic language (for example,
  18. AmigaBasic). Example:
  19.  
  20.         B$="Hello! This is Ronnie!"
  21.         L$=Left$(B$,9)
  22.         Print L$
  23. ( result: Hello! Th )
  24.  
  25.  
  26.  
  27.          =RIGHT$= (return the rightmost character of a string)
  28.  
  29.  
  30. d$=RIGHT$(s$,n)
  31.  
  32. Same as the LEFT$ -instruction, but takes the rightmost characters.
  33.  
  34.         Print Right$("AMOS Basic",5)
  35. ( result: Basic )
  36.  
  37.  
  38.  
  39.       =MID$= (return a string of characters from within a string)           55
  40.  
  41. d$=MID$(s$,p,n)
  42. MID$(d$,p,n)=s$
  43.  
  44. The MID$ function returns the middle section of the string held in s$.
  45. p denotes the offset of characters to the start of this substring, and
  46. n holds the number of characters to be fetched. If a value of "n" is
  47. not specified in the instruction then the characters will be read right
  48. up to the end of your string. Example:
  49.  
  50.         Print Mid$("AMOS Basic",6)
  51. ( result: Basic )
  52.  
  53. There is also a MID$ instruction:
  54.  
  55.         MID$(d$,p,n)=s$
  56.  
  57. This version of MID$ loads "n" characters into d$ starting from
  58. position p+1 in s$. If a value of n is not specified directly then
  59. characters will be replaced up to the end of the source string s$. This
  60. kind of instruction is also possible when using LEFT$ and RIGHT$.
  61. Here's an example:
  62.  
  63.         A$="AMOS *****"
  64.         Mid$(A$,5)="Magic"
  65.         Print A$
  66. ( result: AMOS Magic )
  67.  
  68.  
  69.  
  70.                  =INSTR (search for occurrences of a                        56
  71.                      string within another string)
  72.  
  73. f=INSTR(d$,s$ [,p])
  74.  
  75. INSTR allows you to search for all occurrences of one string inside
  76. another. It is often used in adventure games to split a complete line
  77. of text into its individual commands. There are two possible formats of
  78. the INSTR function.
  79.  
  80. f=INSTR(d$,s$)
  81.  
  82. This searches for the first occurrence of s$ in d$. If the string is
  83. found then its position will be returned directly, otherwise the result
  84. will be set to zero. Examples:
  85.  
  86.         Print Instr("AMOS BASIC","AMOS")
  87. ( result: 1 )
  88.         Print Instr("AMOS BASIC","S")
  89. ( result: 4 )
  90.         Print Instr("AMOS BASIC","AMIGA")
  91. ( result: 0 )
  92.  
  93.  
  94.         Do
  95.           Input "String to be searched";D$
  96.           Input "String to be found";S$
  97.           X=Instr(D$,S$)
  98.           If X=0 Then Print S$;" Not found"
  99.           If X<>0 Then Print S$;" Found at position ";X
  100.         Loop
  101.  
  102. Normally the search will commence from the first character in your text
  103. string (d$). The secont version of INSTR lets you test a specific
  104. section in the string at a time.
  105.  
  106.   p is now the position of the beginning of your search. All characters
  107. are numbered from the left to right starting from zero. Therefore p
  108. ranges from 0 to LEN(s$). Example:
  109.  
  110.         Print Instr("AMOS BASIC","S",5)
  111. ( result: 8)
  112.  
  113.  
  114.  
  115.            =UPPER$ (convert a string of text to upper case)                 57
  116.  
  117. s$=UPPER$(n$)
  118.  
  119. This function converts the string in n$ into upper case (capitals) and
  120. places the result into s$. Example:
  121.  
  122.         Print Upper$("AmOs BaSic")
  123. ( result: AMOS BASIC )
  124.  
  125.  
  126.  
  127.                =LOWER$ (convert a string to lower case)
  128.  
  129. s$=LOWER$(n$)
  130.  
  131. LOWER$ translates all the characters in n$ into lower case. This is
  132. especially useful in adventure games, as you can convert all the user's
  133. input into a standard format which is much easier to interpret.
  134. Example:
  135.  
  136.         Input "Continue (Yes/No)";ANSWER$
  137.         ANSWER$=Lower$(ANSWER$) : If ANSWER$="no" Then Edit
  138.         Print "Continuing with your prog..."
  139.  
  140.  
  141.  
  142.                        =FLIP$ (invert a string)
  143.  
  144. f$=FLIP$(n$)
  145.  
  146. FLIP$ simply reverses the order of the characters held in n$.
  147.  
  148.  
  149.  
  150.                      =SPACE$ (space out a string)
  151.  
  152. s$=SPACE$(n)
  153.  
  154. Generates a string of n spaces and places them into s$. Example:
  155.  
  156.         Print "Twenty" ; Space$(20); "spaces"
  157.  
  158.  
  159.  
  160.                  =STRING$ (create a string full of a$)                      58
  161.  
  162. s$=STRING$(a$,n)
  163.  
  164. STRING$ returns a string with n copies of the first character in a$:
  165.  
  166.         Print String$("The cat sat on the mat",10)
  167. ( result: TTTTTTTTTT )
  168.  
  169.  
  170.  
  171.                     =CHR$ (return Ascii character)
  172.  
  173. s$=CHR$(n)
  174.  
  175. Creates a string containing a single character with Ascii code n.
  176.  
  177.  
  178.  
  179.                  =ASC (get Ascii code of a character)
  180.  
  181. c=ASC(a$)
  182.  
  183. ASC supplies you with the internal Ascii code of the first character in
  184. the string a$:
  185.  
  186.         Print Asc("B")
  187. ( result: 66 )
  188.  
  189.  
  190.  
  191.          =LEN (returns the number of characters stored in a$)
  192.  
  193. This way you can get the length of a string: 
  194.  
  195.         Print Len("12345678")
  196. ( result: 8 )
  197.  
  198.  
  199.  
  200.                    =VAL (convert a string to number)                        59
  201.  
  202. v=VAL(x$)
  203. v#=VAL(x$)
  204.  
  205. VAL converts a list of decimal digits stored in x$ into a number. If
  206. this process fails for some reason, a value of zero will be returned
  207. instead. Example:
  208.  
  209.         X=Val("1234):Print X
  210. ( result: 1234 )
  211.  
  212.  
  213.  
  214.                  =STR$ (convert a number to a string)
  215.  
  216. s$=STR$(n)
  217.  
  218. STR$ converts an integer variable into a string. This can be very
  219. useful because some functions, such as CENTRE, do not allow you to
  220. enter numbers as a parameter. Example:
  221.  
  222.         Centre "Memory left is "+Str$(Chip Free)+" Bytes."
  223.  
  224. Do not confuse STR$ with STRING$.
  225.  
  226.  
  227.  
  228. Array options
  229. =============
  230.  
  231.  
  232.                  SORT (sort all elements in an array)
  233.  
  234. SORT a(0)
  235. SORT a#(0)         The SORT instruction arranges the contents of any
  236. SORT a$(0)         array into ascending order. This array can contain
  237.                    either strings, integers, or floating point numbers.
  238. The a$(0) parameter specifies the starting point of your table. It must
  239. always be set to the first item in the array (item number 0). Example:
  240.  
  241.         Dim A(25)
  242.         P=0
  243.         Repeat
  244.           Input "Input a number (0 to stop)";A(P)
  245.           Inc P
  246.         Until A(P-1)=0 Or P>25
  247.         Sort A(0)
  248.         For I=0 to P-1
  249.           Print A(I)
  250.         Next
  251.  
  252.  
  253.  
  254.                         MATCH (search an array)                             60
  255.  
  256. r=MATCH(t(0),s)
  257. r=MATCH(t#(0),s#)     MATCH searches through a sorted array for the 
  258. r=MATCH(t$(0),s$)     value s. If this is succesfully found then r
  259.                       will be negative. Taking the absolute value of
  260. this figure will provide you with the item which came closest to your
  261. original search parameter.
  262.  
  263.   Note that only arrays with a single dimension can be checked in this
  264. way. You'll also need to sort the array with SORT before calling this
  265. function. Example:
  266.  
  267.         Read N
  268.         Dim D$(N)
  269.         For I=1 to N
  270.           Read D$(I)
  271.         Next I
  272.         Sort D$(0)
  273.         Do
  274.           Input A$
  275.           If A$="L"
  276.             For I=1 to N:Print D$(I):Next I
  277.           Else
  278.             POS=Match(D$(0),A$)
  279.             If POS>0 Then Print "Found",D$(POS);" In Record ";POS
  280.             If POS<0 And Abs(POS)<=N Then Print A$,"Not Found. Closest
  281.                                                      To ",D$(Abs(POS))
  282.             If POS<0 And Abs(POS)>N Then Print A$, "Not Found. Closest
  283.                                                             To ";D$(N)
  284.           Endif
  285.         Loop
  286.         Data 10,"Adams","Asimov","Shaw","Heinlien","Zelazny","Foster"
  287.         Data "Niven","Harrison","Pratchet","Dickson"
  288.  
  289. Note that MATCH could be used in conjunction with the INSTR function to
  290. provide a powerful parser routine. This might be used to interpret the
  291. instructions you entered in an adventure game.
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.                               6:GRAPHICS                                    61
  300.                      -----------------------------
  301.  
  302. AMOS Basic provides you with everything you need to generate some
  303. amazing graphics. There's a comprehensive set of commands for drawing
  304. rectangles, circles and polygons. As you would expect from the Amiga,
  305. all operations are performed practically instantaneously. But even here
  306. AMOS Basic has a trick or two up its sleeve.
  307.  
  308.   The AMOS graphical functions work equally well in all the Amiga's
  309. graphics modes INCLUDING hold and modify mode (HAM). It's therefore
  310. possible to create breathtaking HAM pictures directly within AMOS
  311. Basic!
  312.  
  313.   Furthermore, you're not just limited to the visible screen. If you've
  314. created an extra large playing area, you'll be able to access every
  315. part of your display using the standard drawing routines. So it's easy
  316. to generate the scrolling backgrounds required by arcade games such as
  317. Defender.
  318.  
  319.  
  320. Colours
  321. -------
  322. The Amiga allows you to display up to 64 colours on the screen at a
  323. time. These colours can be selected using the INK,COLOUR and PALETTE
  324. commands.
  325.  
  326.  
  327.  
  328.               INK (set colour used by drawing operations)
  329.  
  330. INK col[,paper][,border]
  331.  
  332. "col" specifies the colour which is to be used for all subsequent
  333. drawing operations. The colour of every point on the screen is taken
  334. from one of 32 different colour registers. These registers can be
  335. individually set with a colour value chosen from a palette of 4096
  336. colours.
  337.  
  338.   Although the Amiga only provides you with 32 actual color registers,
  339. AMOS lets you use colour numbers ranging from 0 to 63. This allows you
  340. to make full use of the colours available from the Half-Bright and HAM
  341. modes respectively. A detailed explanation of these modes can be found
  342. in the Screens chapter.
  343.  
  344.   The "paper" colour sets the background colour fill patterns generated
  345. by the SET PATTERN command.
  346.  
  347.   The "border" colour selects an outline colour for your bars and
  348. polygons. This option can be activated using the SET PAINT command like
  349. so:
  350.  
  351.         Set pattern 0 : Set paint 1
  352.         Repeat
  353.           C=Rnd(16):Ink 16-C,0,C
  354.           X=Rnd(320)-20:Y=Rnd(200)-20:S=Rnd(100)+10
  355.           Bar X,Y to X+S,Y+S
  356.         Until Mouse Key
  357.  
  358. Note that any of the parameters col, paper and border, may be omitted.
  359. Simply include "empty" commas at the appropriate places in the
  360. instruction. For example:
  361.  
  362.         Ink ,,5 : Rem  Just sets the border colour
  363.  
  364.  
  365.  
  366.                   COLOUR (assign a colour to an index)                      62
  367.  
  368. COLOUR index,$RGB
  369.  
  370. The COLOUR instruction allows to assign a colour to each of the Amiga's
  371. 32 colour registers.
  372.  
  373.   "Index" is the number of the colour you wish to change, and can range
  374. from 0-31. As you may know, any colour can be created by mixing
  375. specific amounts of the primary colours Red, Green and Blue. The shade
  376. of your colour is completely determined by the relative intensities of
  377. the three components
  378.  
  379.   The expression $RGB consists of three digits from 0 to F. Each
  380. component sets the strength of one of the primary colours, Red (R),
  381. Green (G) or Blue (B). The size of the components is directly
  382. proportional to the brightness of the associated colour. So the higher
  383. values, the brighter the eventual colour.
  384.  
  385.         Hex Digit   0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F
  386.         Decimal     0  1  2  3  4  5  6  7  8  9  10 11 12 13 14 15
  387.  
  388. HAM and Extra Half-Bright modes use these indices slighty differently.
  389. See Chapter 9 for more details.
  390.  
  391.  
  392.  
  393.                  =COLOUR (read the colour assignment)
  394.  
  395. c=COLOUR(index)
  396.  
  397. The COLOUR function takes an index number from 0 to 31, and returns the
  398. coour value which has been previously assigned to it.
  399.   "Index" is simply the colour number whose shade you wish to
  400. determine. You can use this function to produce a list of the current
  401. colour settings of your Amiga like so:
  402.  
  403.         For C=0 To 15
  404.           Print Hex$(Colour(C),3)
  405.         Next C
  406.  
  407.  
  408.  
  409.                PALETTE (set the current screen colours)                     63
  410.  
  411. PALETTE list of colours
  412.  
  413. The PALETTE instruction is really just a rather more powerful version
  414. of COLOUR. Instead of loading the colour values one at a time, the
  415. PALETTE command allows you to install a whole new palette of colours in
  416. a single statement.
  417.  
  418.         However you don't have to set all the colours in the palette at
  419. once. Any combination of colours can be loaded individually ;
  420.  
  421.         PALETTE $100,$200,$300 : Rem Sets just three colours
  422.  
  423. You can also change selected colours in the middle of your list ;
  424.  
  425.         PALETTE $200,,$400 : Rem Change colours 0 and 2
  426.  
  427. It's important to realise that only the colours in the palette which
  428. are specifically set by this command will actually be changed. All
  429. other colours will retain their original values. Here are some
  430. examples:
  431.  
  432.         Palette 0,$F00,$0F0
  433.         Palette 0,$770
  434.         Palette 0,,$66
  435.         Palette 0,$1,$2,$3,$4,$5,$6,$7,$8,$9,$A,$B,$C,$D,$E,$F
  436.  
  437. At the start of your program the colour palette is automatically loaded
  438. using a list of default color values. These settings can be adjusted
  439. using a simple option from the AMOS configuration program. 
  440.  
  441.   This command can also be used to set the colours used by the
  442. Half-Bright and HAM modes. These extend the existing colour palette to
  443. generate dozends of extra colours on the screen. See chapter 10...
  444.  
  445.  
  446.  
  447. Line drawing commands
  448. =====================
  449.  
  450.  
  451.                  GR LOCATE (position graphics cursor)
  452.  
  453. GR Locate x,y
  454.  
  455. This sets the position of the graphics cursor to screen coordinates
  456. x,y. The graphics cursor is used as the default starting point for most
  457. drawing operations. So if you omit the coordinates from commands such
  458. as PLOT or CIRCLE, the objects will be drawn at the current cursor
  459. position. For example:
  460.  
  461.         Gr Locate 10,10 : Plot ,
  462.         Gr Locate 100,100 : Circle ,,100
  463.  
  464.  
  465.  
  466.                =XGR (return x coordinate of gfx cursor)                     64
  467.                =YGR (return y coordinate of gfx cursor)
  468.  
  469. x=XGR
  470. y=YGR
  471.  
  472. These functions return the present coordinates of the graphics cursor:
  473.  
  474.         Circle 10,100,100
  475.         Print Xgr,Ygr
  476.  
  477.  
  478.  
  479.                       PLOT (plot a single point)
  480.  
  481. PLOT x,y [,c]
  482.  
  483. The PLOT command is the simplest drawing function provided by AMOS
  484. Basic. It plots a point at coordinates x,y using colour c. The new ink
  485. colour will now be used in all subsequent drawing operations.
  486.  
  487.   If the colour "c" is omitted from this instruction, the point will be
  488. plotted in the current colour. For example:
  489.  
  490.         Curs Off: Flash Off : Randomize Timer
  491.         Do
  492.           Plot Rnd(319),Rnd(199),Rnd(15)
  493.         Loop
  494.  
  495. It's also possible to omit the X or Y coordinates from this
  496. instruction. The point will be plotted at the gfx cursor position.
  497.  
  498.         Plot 100,100,4
  499.         Plot ,150
  500.         Cls : Plot ,
  501.  
  502.  
  503.  
  504.                    POINT (get the colour of a point)
  505.  
  506. c=POINT(x,y)
  507.  
  508. POINT returns the colour index of a point at coordinates x,y ;
  509.  
  510.         Plot 100,100
  511.         Print "The colour at 100,100 is ";Point(100,100)
  512.  
  513.  
  514.  
  515.                           DRAW (draw a line)6                               65
  516.  
  517. DRAW is another very Basic instruction. Its action to draw a simple
  518. straight line on the Amiga's screen.
  519.  
  520.         DRAW x1,y1 TO x2,y2
  521.  
  522. Draws a line between the coordinates x1,y1 and x2,y2
  523.  
  524.         DRAW TO x3,y3
  525.  
  526. Draw a line from the current gfx crsr position to x3,y3. Example:
  527.  
  528.         Colour 4,$707:Ink 4
  529.         Draw 0,50 To 200,50
  530.         Draw To 100,100
  531.         Draw To 0,50
  532.  
  533.  
  534.  
  535.                      BOX (draw a hollow retangle)
  536.  
  537. BOX x1,y1 TO x2,y2
  538.  
  539. The BOX command draws a hollow retangular box on the screen. x1,y1 are
  540. the coordinates of the top left corner of the box, and x2,y2 are the
  541. coordinates of the point diagonally opposite. 
  542.  
  543.  
  544.  
  545.                    POLYLINE (multiple line drawing)
  546.  
  547. POLYLINE is very similar to DRAW except that it draws several lines at
  548. a time. It's capable of generating complex hollow polygons in just a
  549. single statement.
  550.  
  551.         POLYLINE x1,y1 TO x2,y2 TO x3,y3
  552.  
  553.  
  554.  
  555.                      CIRCLE (draw a hollow circle)                          66
  556.  
  557. CIRCLE x,y,r
  558.  
  559. The Circle command draws a hollow circle with radius r and centre x,y.
  560.  
  561. As normal, if the coordinates are omitted from this command, the circle
  562. will be drawn from the current cursor position;
  563.  
  564.         Plot 100,100 : Circle ,,50
  565.  
  566.  
  567.  
  568.                     ELLIPSE (draw a hollow ellipse)
  569.  
  570. ELLIPSE x,y,r1,r2
  571.  
  572. The ELLIPSE instruction draws a hollow ellipse at coordinates x,y. The
  573. horizontal radius is r1. It corresponds to exactly half the width of
  574. the ellipse. r2 is the vertical radius and is used to set the height of
  575. the ellipse. The total height of the ellipse is r*2
  576.  
  577.  
  578. Line types                                                                  67
  579. ----------
  580. AMOS Basic allows you to draw your lines using a vast range of possible
  581. line styles.
  582.  
  583.  
  584.  
  585.                     SET LINE (set the line styles)
  586.  
  587. SET LINE mask
  588.  
  589. The SET LINE command sets the style of all lines which are subsequently
  590. drawn using the DRAW, BOX and POLYLINE commands.
  591.  
  592.   "Mask" is a 16-bit binary number which describes the precise
  593. appearance of the line. Any points in the line which are to be
  594. displayed in the current ink colour are represented by a one, and any
  595. points which are to be set to the background colour are indicated by a
  596. zero. So a normal line is denoted by the binary number
  597. %1111111111111111 and will be displayed as _______. Similarly, a dotted
  598. line like _ _ _ _ will be produced by a mask of %1111000011110000.
  599.  
  600.   By setting the line mask to values between 0 and 65535, it is
  601. possible to generate a great variety of different line types ;
  602.  
  603.         Set Line $F0F0
  604.         Box 50,100 To 150,150
  605.  
  606. This line style as no effect on shapes drawn with CIRCLE or ELLIPSE.
  607.  
  608.  
  609.  
  610. Filled shapes
  611. =============
  612.  
  613.  
  614.                          PAINT (contour fill)
  615.  
  616. PAINT x,y,mode
  617.  
  618. The PAINT command allows you to fill any region on the screen with a
  619. solid block of colour. Additionally you can select a fill pattern for
  620. your shapes using the SET PATTERN command. 
  621.  
  622.   x,y are the coordinates of a point inside the area to be filled.
  623. "Mode" can be set to either 0 or 1. A value of 0 terminates the filling
  624. operation at the first pixel found with the current border colour. A
  625. mode of 1 halts the filling operation at any colour which is different
  626. from the existing ink colour.
  627.  
  628. See EXAMPLE 6.1  in the MANUAL folder for a demonstration.
  629.  
  630.  
  631.  
  632.                      BAR (draw a filled rectangle)                          68
  633.  
  634. BAR x1,y1 TO x2,y2
  635.  
  636. Draws a filled bar from x1,y1 -the coordinates of the top left corner
  637. of the bar- to x2,y2 -the opposite corner coordinates. 
  638.  
  639.  
  640.  
  641.                     POLYGON (draw a filled polygon)
  642.  
  643. POLYGON x1, TO x2,y2 TO x3,y3 ...
  644. POLYGON TO x1,y1 TO x2,y2 ...
  645.  
  646. POLYGON generates a filled polygon in the current ink colour It's
  647. basically just a solid version of the standard POLYLINE command.
  648. There's no real limit to the number of coordnate pairs you may use,
  649. other than the maximum line length permitted by AMOS Basic (255 chars).
  650.  
  651.  
  652.  
  653. Fill types
  654. ----------
  655. In AMOS Basic you're not just restricted to filling your shapes with a
  656. solid block of colour. There are dozens of fill patterns to choose
  657. from, and you can even load your own patterns directly from the sprite
  658. bank.
  659.  
  660.  
  661.  
  662.                    SET PATTERN (select fill pattern)                        69
  663.  
  664. SET PATTERN pattern
  665.  
  666. This command allows you to select a fill pattern for use by your
  667. drawing operations. There are three possibilities
  668.  
  669.         Pattern=0
  670.  
  671. This is the default, and fills your shapes with a solid block of the
  672. current INK colour.
  673.  
  674.         Pattern>0
  675.  
  676. If the pattern number is >0, AMOS Basic selects on of 34 built-in fill
  677. styles. These are found in the MOUSE.ABK file on your start-up disc,
  678. and can be edited using the AMOS Basic sprite definer. Note that the
  679. first three images in this files are required by the mouse cursor (see
  680. CHANGE MOUSE). The fill patterns are stored in the images from four
  681. onwards.
  682.  
  683.         Pattern<0
  684.  
  685. This is the most powerful option of all. "Pattern" now refers to a
  686. sprite image in bank one. The image is number calculated using the
  687. formula:  SPRITE IMAGE = PATTERN * (-1)
  688.  
  689. The selected image will be automatically truncated before use,
  690. according to the following rules
  691.  
  692.  * The width of the image will be clipped to sixteen pixels
  693.  * The height will be rounded to the nearest power of two, ie 1,2..,64
  694.  
  695. Depending on the type of your image, the pattern will be drawn in one
  696. of two separate ways. Two-colour images are drawn in "monochrome". The
  697. actual colours in your image are completely discarded, and the pattern
  698. is drawn using the current ink and paper colours.
  699.  
  700.   It's also possible to produce multi-coloured fill patterns. In this
  701. case the foreground colours of your image and merged with the current
  702. ink colour using a logical AND. Similarly the paper colours of your
  703. pattern is OR'ed with the sprite background (colour zero). If you wish
  704. to use your original sprite colours, you'll need to set the ink and
  705. background colours like so:
  706.  
  707.         Ink 31,0
  708.  
  709. Don't forget to load your sprite palette from the sprite bank with
  710. GET SPRITE PALETTE before using these instructions, otherwise the
  711. display is likely to look rather messy. Examples of this instruction
  712. can be found in EXAMPLE 6.2  in the MANUAL folder.
  713.  
  714.  
  715.  
  716.                  SET PAINT (set / reset outline mode)                       70
  717.  
  718. SET PAINT n
  719.  
  720. Toggles the outline drawn by the POLYGON or BAR instructions. As a
  721. default this mode is set to OFF.
  722.   
  723.   If n=1 then outline mode will be activated.
  724.  
  725.  
  726.  
  727. Writing styes
  728. =============
  729.  
  730.  
  731.                    GR WRITING (ghange writing mode)
  732.  
  733. GR WRITING bitpattern
  734.  
  735. Whenever you draw some graphics on the screen, you naturally assume
  736. that anything underneath it will be overwriteen. The GR WRITING command
  737. allows you to choose from a range of four alternative drawing modes.
  738. These can used to generate dozens of intriguing effects.
  739.  
  740.   "Bitpattern" holds a sequence of binary bits which specify which
  741. graphics mode you wish to use. Here's a list of the various
  742. possibilities along with a brief explanation of their effects:
  743.  
  744. JAM1 mode (Bit 0=0)
  745.                     JAM1 only draws the parts of your graphics which
  746. are set to the current INK colour. Any sections drawn in the paper
  747. colour are totally omitted. This is particularly useful with with the
  748. TEXT command as it allows you to merge your text directly over an
  749. existing screen background. For example:
  750.  
  751.         Ink 2,5:Text 140,80,"Normal Text":Gr Writing 0:
  752.                                      Text 140,71,"JAM1"
  753.  
  754. JAM2 mode (Bit 0=1)
  755.                     This is the default condition. Any existing
  756. graphics on the screen will be completely replaced by your new image.
  757.  
  758.  
  759. XOR mode (Bit 1=1)
  760.                     XOR combines your new graphics with those already
  761. on the screen using a logical operation known as eXclusive OR. The net
  762. result is to change the colour of the areas of a drawing which overlap
  763. an existing picture.
  764.  
  765.   One interesting side effect of XOR mode is that you can erase any
  766. object from the screen by simply setting XOR mode and drawing your
  767. object again at exactly the same position. EXAMPLE 6.3  contains a
  768. simple demonstration of this technique and produces a neat rubber and
  769. banding effect.
  770.  
  771.  
  772. INVERSEVID (Bit 2=1)
  773.                      This reverses the image before it is drawn. So any
  774. sections of your image drawn in the ink colour will be replaced by the
  775. current paper colour and vice-versa. INVERSEVID mode is often used to
  776. produce inverted text.
  777.  
  778.   Since these modes are set using a bitpattern, it's possible to
  779. combine several mode together.
  780.  
  781.         Gr Writing 4+1 : Rem set JAM2 and INVERSEVID
  782.         Gr Writing 7   : Rem chooses JAM2,INVERSEVID and XOR
  783.         Ink 2,5 : Text 140,80,"Accession & Image rulez!"
  784.  
  785. NOTE: This command only affects drawing operations such as CIRCLE, BOX
  786. and graphical text (TEXT). The drawing mode used by normal text
  787. commands like PRINT and CENTRE is set using a separate WRITING command.
  788. See also AUTOBACK.
  789.  
  790.  
  791.  
  792.           CLIP (restrict all gfx to a section of the screen)                71
  793.  
  794. CLIP [x1,y1 TO x2,y2]
  795.  
  796. The CLIP instruction limits all drawing operations to a rectangular
  797. region of the screen specified by the coordinates x1,y1 to x2,y2.
  798.  
  799.   x1,y1 represent the coordinates of the top left hand corner of the
  800. rectangle, and x2,y2 hold the coordinates of the bottom right corner.
  801.  
  802.   Note that it's perfectly acceptable to use coordinates outside the
  803. normal screen boundaries. All the clipping operations will work as
  804. expected, even if only a section of the clipping rectangle is actually
  805. visible.
  806.  
  807.   As you can see, only the parts of the circle which lie within the
  808. clipping rectangle have been drawn on the screen. The clipping zone can
  809. be restored to the normal screen area. by omitting all the coordinates
  810. from this instruction.
  811.  
  812.   See EXAMPLE 6.4  in the MANUAL folder.
  813.  
  814.  
  815.  
  816. Advanced techniques
  817. ===================
  818.  
  819.  
  820.                   SET TEMPRAS (set temporary raster)
  821.  
  822. SET TEMPRAS [address,size]
  823.  
  824. This instruction allows experienced Amiga programmers to fine tune the
  825. amount of memory used by various graphics operations. WARNING:
  826. improper use of this instruction can crash your Amiga copletely!
  827.  
  828.   Whenever an AMOS program performs a fill command, a special memory
  829. area is reserved to hold the fill pattern. This memory is automatically
  830. returned to the system after the instruction has been terminated. The
  831. size of the memory buffer is equivalent to a single bit plane in the
  832. current screen mode. So the default screen takes up to a total of 8k.
  833.  
  834.   The size and location of the graphics buffer can be changed at any        72
  835. time using the SET TEMPRAS instruction.
  836.  
  837.   "Size" is the number of bytes you wish to reserve for your buffer
  838. area. It ranges between 256 and 65536.
  839.  
  840.   The amount of memory required for a particular object can be
  841. calculated in the following way:
  842.  
  843.         - Enclose the object to be drawn with a rectangular box
  844.         - The area required will given by: Size=Width/8 * Height.
  845.  
  846. If you are intending to use the PAINT command, you should take care to
  847. ensure that your figure is *closed*, otherwise more memory will be
  848. neede and the system may crash. 
  849.  
  850.   "Buffer" can be either an addess or a memory bank. The memory you
  851. reserve for this buffer should always be CHIP ram. Since the buffer
  852. area is now allocated once and for all at the start of your program,
  853. there's no need to continually reserve and restore the memory buffer.
  854. This can speed up the execution of your programs by up to 5 %.
  855.  
  856.   You can restore the buffer area to its original value by calling the
  857. SET TEMPRAS command with no parameters.
  858.  
  859.   See the EXAMPLE 6.5  in the MANUAL folder.
  860.